home *** CD-ROM | disk | FTP | other *** search
/ SGI Performance Co-Pilot 1.3 / SGI Performance Co-Pilot 1.3.iso / dist / pcp.idb / usr / sbin / txmonvis.z / txmonvis
Text File  |  1997-04-03  |  3KB  |  147 lines

  1. #!/bin/sh
  2. #  Copyright (c) 1994 Silicon Graphics, Inc.
  3. #  ALL RIGHTS RESERVED.
  4. #  U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND
  5. #  Use, duplication or disclosure by the Government is subject to
  6. #  restrictions as set forth in FAR 52.227.19(c)(2) or subparagraph
  7. #  (c)(1)(ii) of the Rights in Technical Data and Computer Software clause
  8. #  at DFARS 252.227-7013 and/or similar or successor clauses in the FAR,
  9. #  or the DOD or NASA FAR Supplement.  Contractor/manufacturer is Silicon
  10. #  Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
  11. #  THIS SOFTWARE CONTAINS CONFIDENTIAL AND PROPRIETARY INFORMATION OF
  12. #  SILICON GRAPHICS, INC.  ANY DUPLICATION, MODIFICATION, DISTRIBUTION, OR
  13. #  DISCLOSURE IS STRICTLY PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN
  14. #  PERMISSION OF SILICON GRAPHICS, INC.
  15. # /
  16.  
  17. #
  18. # $Id: txmonvis,v 2.1 1997/03/26 02:45:59 kenmcd Exp $
  19. #
  20.  
  21. tmp=/tmp/$$
  22. trap "rm -f $tmp.*; exit" 0 1 2 3  15
  23. rm -f $tmp.*
  24.  
  25. verbose=false
  26. version="2"
  27.  
  28. . /usr/pcp/lib/pmview-args
  29.  
  30. _usage()
  31. {
  32.     echo 'Usage: txmonvis [options]
  33.  
  34. options:
  35.   -V              verbose/diagnostic output  
  36.  
  37. pmview(1) options:'
  38.  
  39.     _pmview_usage
  40.     echo
  41.     echo 'Default title is: CPU Utilization for Host'
  42. }
  43.  
  44. _pmview_args "$@"
  45.  
  46. if [ "X$otherArgs" != X ]
  47. then
  48.     while getopts "?V" c $otherArgs
  49.     do
  50.     case $c
  51.     in
  52.         V)
  53.         verbose=true
  54.         ;;
  55.         ?)
  56.         _usage
  57.         exit 1
  58.         ;;
  59.     esac
  60.     done
  61.     set - $otherArgs
  62.     set - $otherArgs
  63.     shift `expr $OPTIND - 1`
  64.     if [ $# -gt 0 ]
  65.     then
  66.     _usage
  67.     exit 1
  68.     fi    
  69. fi
  70.  
  71. rm -f $tmp.tx
  72. if [ "X$arch" != X ]
  73. then
  74.     pminfo -a $arch -f txmon.count >$tmp.tx
  75.     host=`pmdumplog -l $arch | awk '/^Performance/ {print $5}' | sed -e 's/,//g'`
  76.     [ "X$host" = X ] && host="unknown host"
  77.     host="$host (Archive $arch)"
  78. elif [ "X$host" = X ]
  79. then
  80.     host=`/usr/bsd/hostname`
  81. fi
  82.  
  83. # if not an archive, contact the host
  84. [ ! -f $tmp.tx ] && pminfo -f -h $host txmon.count >$tmp.tx
  85.  
  86. tx=`sed <$tmp.tx -n -e '/inst \[/{
  87. s/"].*//
  88. s/.*"//
  89. p
  90. }'`
  91.  
  92. if [ -z "$tx" ]
  93. then
  94.     echo "$prog: cannot get inventory of transaction type names"
  95.     exit 1
  96. fi
  97.  
  98. if [ -z "$titleArg" ]
  99. then
  100.     titleArg="Transaction Activity for Host $host"
  101. fi
  102.  
  103. # pmview version 2.0 assumed
  104. #
  105. echo >$tmp.config '# pmview 2.0
  106. _scale 1.05
  107. _colorlist time ( red2 blue2 )
  108. _colorlist count ( green2 )
  109.  
  110. _grid 1 3 (
  111.     _labeledbar 0 0 (
  112.         _metrics (
  113.             txmon.max_time 30
  114.             txmon.ave_time 30
  115.         )
  116.         _metriclabels ( "max" "ave" )
  117.         _colorlist time
  118.     )
  119.     _labeledbar 0 2 (
  120.         _metrics (
  121.             txmon.count 10
  122.         )
  123.         _metriclabels ( "count" )'
  124. echo "        _instlabels away (\c" >>$tmp.config
  125. for x in $tx
  126. do
  127.     echo " \"$x\"\c" >>$tmp.config
  128. done
  129. echo >>$tmp.config ' )
  130.         _colorlist count
  131.    )
  132. )
  133. '
  134.  
  135. if $verbose
  136. then
  137.     echo "pmview $version.0 Config:"
  138.     cat $tmp.config
  139. fi
  140.  
  141. eval /usr/sbin/pmview <$tmp.config $args -title "'$titleArg'" -xrm "'*iconName: txmonvis'"
  142.  
  143. exit
  144.